#ifndef LEOGRAPHICS_H_ 
#define LEOGRAPHICS_H_
#pragma comment (lib,"opengl32.lib")
#pragma comment(lib,"GLu32.lib")
#pragma comment(lib,"SOIL.lib")
#include <GL/GL.h>
#include <GL/GLU.h>
#include "GL/SOIL.h"
#include "RAWReader.h"
#include "MarchingCubes.h"
#include "LeoVisualizer.h"
#include <vector>
using namespace std;

class LeoGraphics
{
public:
	LeoGraphics();
	~LeoGraphics();
	int InitGL(GLvoid);
	GLvoid ReSizeGLScene(GLsizei width, GLsizei height);
	float CalAbVal(float x, float y, float z);
	void MouseRotation(LPARAM lParam);
	void LoadTrianglesToPointer(HWND hwndParent, HINSTANCE g_hinst);
	int DrawGLScene(GLsizei width, GLsizei height);
	void RotKeyDown(LPARAM lParam);
	void ChangeZoom(float val);
	int CheckInside(LPARAM lParam);
	int Read(string s, HWND hwnd, HINSTANCE hinst);
	TRIANGLE* (*ReconstructionAlgorithm)(int X, int Y, int Z, 
		MCVector* vertices, float isoValue, int &numberOfTriangles, HWND hwndParent, HINSTANCE g_hinst);
	int getOneSlice(int frames);
	int changeAlgorithm(int i, HWND hwndParent, HINSTANCE g_hinst);

public:
	
	GLfloat rtri;				
	GLfloat ptri;
	int px;
	int py;
	float zoomFactor;
	//lighting
	bool lightChange;
	int lightSelect;
	bool autoRot;

	// EDO
	int RotationDirection;

	bool canDraw;
	bool canRender;
	bool viewSlices;
	RAWReader* reader;
	int curFrame;
private:
	int LoadGLTextures();

	TRIANGLE *triangles;
	MCVector* vertices;
	int numberOfTriangles;
	int cellH;
	int cellW;
	int cellF;
	float *verts;
	float *normals;
	GLuint  *indices;
	float *textCoords;
	
	float *ambient_color;
	float *diff_color;
	float *spec_color;

	float *quadVerts;
	float *quadColors;

	GLuint *texture1;
	GLuint *texture2;
	int idx;
};

#endif